package time;

public class VectorClock {
	private VectorTimeStamp t; // the current time of this VectorClock
	
	public VectorClock(int n, int pos){
		t = new VectorTimeStamp(n, pos);
	}
	
	public void timestampNextEvent(){
		t.increment();
	}
	
	public VectorTimeStamp getTimeStamp(){
		return this.t.clone();
	}

	public VectorTimeStamp updateUponReceive(VectorTimeStamp msg_ts){
		this.t.increment(msg_ts);
		return this.t;
	}

	/*protected void initialize(int pos, int numHosts) {
		((VectorTimeStamp)t).initialize(pos, numHosts);
	}*/

	// this method shall only be called when Vector is used in multicast
	public void updateUponDeliver(VectorTimeStamp incoming_ts) {
		t.increment(incoming_ts.getPos());
	}
}
